﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace inventory.forms
{
    public partial class statementInventory : baseStatementInventory
    {
        public statementInventory()
        {
            InitializeComponent();
            this.myAutoEditKeyGroup = "STAMNT_WHOUSE";
        }

        #region private
        private optionStatementtInventory myPrintOptionForm = null;
        #endregion

        public override void Print(bool fPreview)
        {
            if (myPrintOptionForm == null)
            {
                myPrintOptionForm = new optionStatementtInventory();
                myPrintOptionForm.myOnProcess += new common.forms.baseDialogForm.onProcess(Print_Handler);  
            }
            myPrintOptionForm.ShowForm();
        }

        #region event
        private void Print_Handler(object sender, common.myTypes.DialogEvent e)
        {
            if (e.isCloseClick) return;
            e.acceptClose = false;
            optionStatementtInventory.Options myOption = myPrintOptionForm.myOption;
            switch (myOption.type)
            {
                case optionStatementtInventory.FormTypes.InventoryStatement:
                    PrintStatement(true, myOption.printWithDetail);
                    break;
                case optionStatementtInventory.FormTypes.InventoryStatementReturn:
                    PrintStatementReturn(true);
                    break;
            }
        }
        #endregion
    }
}
